//
// Created by LoveHoneyYou on 2024-11-16.
//

#ifndef WEBSERVER_DISPATCHER_H
#define WEBSERVER_DISPATCHER_H

#include "Channel.h"
#include "EventLoop.h"
#include <string>

class EventLoop;
class Dispatcher
{
public:
    Dispatcher(EventLoop* event_loop);
    virtual ~Dispatcher();
    virtual int Add() = 0;
    virtual int Remove() = 0;
    virtual int Modify() = 0;
    virtual int Dispatch(int timeout = 2) = 0;

    inline void Set_Channel(Channel* channel)
    {
        channel_ = channel;
    }

protected:
    std::string name_;
    Channel* channel_;
    EventLoop* event_loop_;
};





#endif//WEBSERVER_DISPATCHER_H
